//
//  MovieCell.m
//  12.30_homework_豆瓣电影MVC
//
//  Created by dllo on 15/12/30.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "MovieCell.h"
// MARK:VIEW_CENTER_X:屏中心x轴
#define VIEW_CENTER_X self.view.center.x

// MARK:VIEW_CENTER_Y:屏中心y轴
#define VIEW_CENTER_Y self.view.center.y

// MARK:HEIGHT:屏高
#define HEIGHT self.contentView.frame.size.height

// MARK:WIDTH:屏宽
#define WIDTH self.contentView.frame.size.width

@implementation MovieCell

- (void)dealloc {
    [_blueImage release];
    [_picImage release];
    [_title release];
    [_pubdate release];
    [_rating release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCell];
    }
    return self;
}

- (void)creatCell {
    
    self.blueImage = [[UIImageView alloc] init];
    [self.contentView addSubview:_blueImage];
    [_blueImage release];
    
    self.picImage = [[UIImageView alloc] init];
    [_blueImage addSubview:_picImage];
    [_picImage release];
    
    self.title = [[UILabel alloc] init];
    [_blueImage addSubview:_title];
    [_title release];
    
    self.pubdate = [[UILabel alloc] init];
    [_blueImage addSubview:_pubdate];
    [_pubdate release];
    
    self.rating = [[UILabel alloc] init];
    [_blueImage addSubview:_rating];
    [_rating release];
    

    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    _blueImage.frame = CGRectMake(20, 20, WIDTH - 40, 180);
    _blueImage.image = [UIImage imageNamed:@"bg_eventlistcell@2x.png"];
    
    _picImage.frame = CGRectMake(10, 20, WIDTH / 3, 140);
    
    _title.frame = CGRectMake(WIDTH / 3 + 20, 20, 200, 30);
    
    _pubdate.frame = CGRectMake(WIDTH / 3 + 20, 70, 200, 30);
    
    _rating.frame = CGRectMake(WIDTH / 3 + 20, 120, 200, 30);
    

}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
